import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PunchForm, PunchQuery, PunchVO } from './types';

/**
 * 查询员工打卡记录列表
 * @param query
 * @returns {*}
 */

export const listPunch = (query?: PunchQuery): AxiosPromise<PunchVO[]> => {
  return request({
    url: '/proj/punch/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询员工打卡记录详细
 * @param punchId
 */
export const getPunch = (punchId: string | number): AxiosPromise<PunchVO> => {
  return request({
    url: '/proj/punch/' + punchId,
    method: 'get'
  });
};

/**
 * 新增员工打卡记录
 * @param data
 */
export const addPunch = (data: PunchForm) => {
  return request({
    url: '/proj/punch',
    method: 'post',
    data: data
  });
};

/**
 * 修改员工打卡记录
 * @param data
 */
export const updatePunch = (data: PunchForm) => {
  return request({
    url: '/proj/punch',
    method: 'put',
    data: data
  });
};

/**
 * 删除员工打卡记录
 * @param punchId
 */
export const delPunch = (punchId: string | number | Array<string | number>) => {
  return request({
    url: '/proj/punch/' + punchId,
    method: 'delete'
  });
};
